//添加
function add_in(){
    var in_ele = document.getElementById('input');
    var new_one = document.getElementById('example').cloneNode(true);
    new_one.removeAttribute('id');
    new_one.querySelector('.number').innerHTML = document.getElementById('content').querySelectorAll('.note').length;
    new_one.querySelector('.text').innerHTML = in_ele.value;
    document.getElementById('content').appendChild(new_one);
    
}
//清空
function clear_all(){
    var content = document.getElementById('content');
    content.innerHTML='<div id="content"><div id="example" class="note"><div class="order"><p class="number">0</p></div><p class="text">hh</p></div></div></div>';//初始化
}
//倒序
function reverse(){
    var contents = document.getElementById('content');
    var notes = contents.querySelectorAll('.note');
    clear_all();
    const array = Array.from(notes);
    array.reverse();
    for(let i=0;i<array.length-1;i++)
    {
    contents.appendChild(array[i]);
    }
    reset_number();
}
//重排序
function reset_number(){
    var contents =document.getElementById('content');
    var notes =contents.querySelectorAll('.note');
    for(let i=1;i<notes.length;i++)
    {
        notes[i].querySelector('.number').innerHTML=i;
    }
}
//双击删除
function clear_it(target)
{
    target.parentNode.removeChild(target);
    reset_number();
}
//更换背景
const img = [
    {URL:'../image/1.jpg'},
    {URL:'../image/2.jpg'},
    {URL:'../image/3.jpg'}
]

function change_img(){
        const random =Math.floor(Math.random()*img.length).toString(10);
        document.body.style.backgroundImage = `url(../image/${random}.jpg)`;
}